\hypertarget{group__usb__api}{
\section{Usb\_\-api}
\label{group__usb__api}\index{Usb\_\-api@{Usb\_\-api}}
}
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__usb__api_ga49eb5dbf15de9f81a4c8435459df69ab}{
\#define {\bfseries USB\_\-INT\_\-RX\_\-SHIFT}~8}
\label{group__usb__api_ga49eb5dbf15de9f81a4c8435459df69ab}

\item 
\hypertarget{group__usb__api_ga30003dae047f43963cd6ba85ae6f0689}{
\#define {\bfseries USB\_\-INTEP\_\-RX\_\-SHIFT}~16}
\label{group__usb__api_ga30003dae047f43963cd6ba85ae6f0689}

\item 
\hypertarget{group__usb__api_gaa121d3232f82033f2ff756d238cb0894}{
\#define {\bfseries USB\_\-INT\_\-STATUS\_\-SHIFT}~24}
\label{group__usb__api_gaa121d3232f82033f2ff756d238cb0894}

\item 
\hypertarget{group__usb__api_ga20ceb718c0b5bea3d8b0a8d89919160c}{
\#define {\bfseries USB\_\-RX\_\-EPSTATUS\_\-SHIFT}~16}
\label{group__usb__api_ga20ceb718c0b5bea3d8b0a8d89919160c}

\item 
\hypertarget{group__usb__api_gaadf74b0caf840f0d3222cb1dc563684c}{
\#define {\bfseries EP\_\-OFFSET}(Endpoint)~(Endpoint -\/ 0x10)}
\label{group__usb__api_gaadf74b0caf840f0d3222cb1dc563684c}

\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{group__usb__api_ga0845c547b9d4d8f7025b4623ad701d2e}{USBHostSuspend} (unsigned long ulBase)
\item 
void \hyperlink{group__usb__api_gaeb924eb6327a04c66e944848bddd84b5}{USBHostReset} (unsigned long ulBase, tBoolean bStart)
\item 
void \hyperlink{group__usb__api_gaf5c998ca2cba236d8ab11dcbff267023}{USBHostResume} (unsigned long ulBase, tBoolean bStart)
\item 
unsigned long \hyperlink{group__usb__api_gaa695facd945c1bcdafe8f3b722e88071}{USBHostSpeedGet} (unsigned long ulBase)
\item 
unsigned long \hyperlink{group__usb__api_ga70f8544023e3df8fc650c8f18cd81e8f}{USBIntStatus} (unsigned long ulBase)
\item 
void \hyperlink{group__usb__api_gabf639c393de9dc884e0b6b62b5dcb938}{USBIntDisable} (unsigned long ulBase, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_ga53b0ca815f41c12d45a735e3e6d377de}{USBIntEnable} (unsigned long ulBase, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_ga9064db5f49a1fd7cd3dbf02309c8c254}{USBIntDisableControl} (unsigned long ulBase, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_gad152c2b8f218aed6f21dbf7ba54bea58}{USBIntEnableControl} (unsigned long ulBase, unsigned long ulFlags)
\item 
unsigned long \hyperlink{group__usb__api_gae13f9c6435c0f072af9643913fade315}{USBIntStatusControl} (unsigned long ulBase)
\item 
void \hyperlink{group__usb__api_ga413bae5d18d8c6fd4be4bdabdb0172e9}{USBIntDisableEndpoint} (unsigned long ulBase, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_gacc31ab0964a8382e894c8be830a6791e}{USBIntEnableEndpoint} (unsigned long ulBase, unsigned long ulFlags)
\item 
unsigned long \hyperlink{group__usb__api_ga22cf47341e0dd3178ec17af248360dbd}{USBIntStatusEndpoint} (unsigned long ulBase)
\item 
void \hyperlink{group__usb__api_ga56f1a4f5b773b4b5a89b492b96ce57a0}{USBIntRegister} (unsigned long ulBase, void($\ast$pfnHandler)(void))
\item 
void \hyperlink{group__usb__api_ga166af544e888c91b7e284ee0c43b2113}{USBIntUnregister} (unsigned long ulBase)
\item 
unsigned long \hyperlink{group__usb__api_ga030910af40f5281fce288d14963496fe}{USBEndpointStatus} (unsigned long ulBase, unsigned long ulEndpoint)
\item 
void \hyperlink{group__usb__api_ga91480530ccd4a90d62c8da7e06d5f9bc}{USBHostEndpointStatusClear} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_gac8b1a9f07b874f21c7019da7736ef3bc}{USBDevEndpointStatusClear} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_ga46015457955456164c5d28ce0eb9361f}{USBHostEndpointDataToggle} (unsigned long ulBase, unsigned long ulEndpoint, tBoolean bDataToggle, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_ga049dc57ea0604e549a6e632794b18ce1}{USBEndpointDataToggleClear} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_ga9de4dbcc329487f93a98e27a34e82243}{USBDevEndpointStall} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_ga9c38fa1ac6b9034d4c53a7099c6a9ae0}{USBDevEndpointStallClear} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_gae9944bff638d3f72165915d25d306dda}{USBDevConnect} (unsigned long ulBase)
\item 
void \hyperlink{group__usb__api_ga973c6f78b445e39c1acf7b8bd068e764}{USBDevDisconnect} (unsigned long ulBase)
\item 
void \hyperlink{group__usb__api_ga98c0f50c48d71a9710865ab17ab608e7}{USBDevAddrSet} (unsigned long ulBase, unsigned long ulAddress)
\item 
unsigned long \hyperlink{group__usb__api_gab7b96baeea1e914020c78ed18db35481}{USBDevAddrGet} (unsigned long ulBase)
\item 
void \hyperlink{group__usb__api_ga6aa974855c1640bb3773ab0ab711facb}{USBHostEndpointConfig} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulMaxPayload, unsigned long ulNAKPollInterval, unsigned long ulTargetEndpoint, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_ga15055725003cfdcd8df6e533c2c5dafc}{USBDevEndpointConfigSet} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulMaxPacketSize, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_ga3eb2ba5310b0c9a489ff04f56cff61da}{USBDevEndpointConfigGet} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long $\ast$pulMaxPacketSize, unsigned long $\ast$pulFlags)
\item 
void \hyperlink{group__usb__api_gaf3ebf886ffebb5fc04d8299d22bb16ab}{USBFIFOConfigSet} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulFIFOAddress, unsigned long ulFIFOSize, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_gaeb3b6b1ac6a999b23db4925d5dda6fa2}{USBFIFOConfigGet} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long $\ast$pulFIFOAddress, unsigned long $\ast$pulFIFOSize, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_gaaf638b1dd57ccc96e0cd1f8734f4adf9}{USBEndpointDMAEnable} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_ga6c4dbeca3addcf3dbee3bf9b68f6f8fb}{USBEndpointDMADisable} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulFlags)
\item 
unsigned long \hyperlink{group__usb__api_gab6030b6001c69200f951a09b02b924d7}{USBEndpointDataAvail} (unsigned long ulBase, unsigned long ulEndpoint)
\item 
long \hyperlink{group__usb__api_ga8822f6e0cad7d22301878b475785c87e}{USBEndpointDataGet} (unsigned long ulBase, unsigned long ulEndpoint, unsigned char $\ast$pucData, unsigned long $\ast$pulSize)
\item 
void \hyperlink{group__usb__api_ga8aa6980c19910b4bb169367591ebfc99}{USBDevEndpointDataAck} (unsigned long ulBase, unsigned long ulEndpoint, tBoolean bIsLastPacket)
\item 
void \hyperlink{group__usb__api_gab69d6597394838de529b7f26f448f76a}{USBHostEndpointDataAck} (unsigned long ulBase, unsigned long ulEndpoint)
\item 
long \hyperlink{group__usb__api_ga95b4d28e107608b288a2bc9325d7ad7c}{USBEndpointDataPut} (unsigned long ulBase, unsigned long ulEndpoint, unsigned char $\ast$pucData, unsigned long ulSize)
\item 
long \hyperlink{group__usb__api_ga3c32912e36754a4f4e7c666f01dccab5}{USBEndpointDataSend} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulTransType)
\item 
void \hyperlink{group__usb__api_ga40c0313238896b15cb08c5af6415930f}{USBFIFOFlush} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_gab2c766b82a33c3db7b98c84e597c368b}{USBHostRequestIN} (unsigned long ulBase, unsigned long ulEndpoint)
\item 
void \hyperlink{group__usb__api_ga07b3554cea8cbae9a816ff726eea9fc6}{USBHostRequestStatus} (unsigned long ulBase)
\item 
void \hyperlink{group__usb__api_gac63fff267fe53846275e0812d170c3f3}{USBHostAddrSet} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulAddr, unsigned long ulFlags)
\item 
unsigned long \hyperlink{group__usb__api_gad87853e0cab3b6468b8a4df0cfe815a9}{USBHostAddrGet} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_ga9f1504e02063b617ce64ccc1f52ad4d8}{USBHostHubAddrSet} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulAddr, unsigned long ulFlags)
\item 
unsigned long \hyperlink{group__usb__api_ga7f085d399f209190e157ae5d9163957e}{USBHostHubAddrGet} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_gaa9391409fc826c386b8832aa5bd06d33}{USBHostPwrConfig} (unsigned long ulBase, unsigned long ulFlags)
\item 
void \hyperlink{group__usb__api_gad38b77c7eadac8f0fa6872ecc487594b}{USBHostPwrFaultEnable} (unsigned long ulBase)
\item 
void \hyperlink{group__usb__api_ga6d8caaf60d312428973e917abafb7165}{USBHostPwrFaultDisable} (unsigned long ulBase)
\item 
void \hyperlink{group__usb__api_ga42edf6615bf04517c23d855c9bc2306b}{USBHostPwrEnable} (unsigned long ulBase)
\item 
void \hyperlink{group__usb__api_ga89ba4fe30d67d75a2b3f4fb8843345ab}{USBHostPwrDisable} (unsigned long ulBase)
\item 
unsigned long \hyperlink{group__usb__api_gaf71e5390559256c1acef164d7a19d31b}{USBFrameNumberGet} (unsigned long ulBase)
\item 
void \hyperlink{group__usb__api_ga048c5620ed2d97e02b1f96c10dcd8e9f}{USBOTGSessionRequest} (unsigned long ulBase, tBoolean bStart)
\item 
unsigned long \hyperlink{group__usb__api_gab4c5b6b760d2e0a74c791bd6648cc780}{USBFIFOAddrGet} (unsigned long ulBase, unsigned long ulEndpoint)
\item 
unsigned long \hyperlink{group__usb__api_ga2cf0f15617aa69bc0fdf6f3df9f0b572}{USBModeGet} (unsigned long ulBase)
\item 
void \hyperlink{group__usb__api_gabd41bc3471a0277bfcbe743019fa7b06}{USBEndpointDMAChannel} (unsigned long ulBase, unsigned long ulEndpoint, unsigned long ulChannel)
\item 
void \hyperlink{group__usb__api_ga9ad32d39a6455f24b18fba0cd20e6478}{USBHostMode} (unsigned long ulBase)
\end{DoxyCompactItemize}


\subsection{Function Documentation}
\hypertarget{group__usb__api_gab7b96baeea1e914020c78ed18db35481}{
\index{usb\_\-api@{usb\_\-api}!USBDevAddrGet@{USBDevAddrGet}}
\index{USBDevAddrGet@{USBDevAddrGet}!usb_api@{usb\_\-api}}
\subsubsection[{USBDevAddrGet}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long USBDevAddrGet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gab7b96baeea1e914020c78ed18db35481}
Returns the current device address in device mode.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function will return the current device address. This address was set by a call to \hyperlink{group__usb__api_ga98c0f50c48d71a9710865ab17ab608e7}{USBDevAddrSet()}.

\begin{DoxyNote}{Note}
This function should only be called in device mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
The current device address. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga98c0f50c48d71a9710865ab17ab608e7}{
\index{usb\_\-api@{usb\_\-api}!USBDevAddrSet@{USBDevAddrSet}}
\index{USBDevAddrSet@{USBDevAddrSet}!usb_api@{usb\_\-api}}
\subsubsection[{USBDevAddrSet}]{\setlength{\rightskip}{0pt plus 5cm}void USBDevAddrSet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulAddress}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga98c0f50c48d71a9710865ab17ab608e7}
Sets the address in device mode.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulAddress}]is the address to use for a device.\end{DoxyParams}
This function will set the device address on the USB bus. This address was likely received via a SET ADDRESS command from the host controller.

\begin{DoxyNote}{Note}
This function should only be called in device mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gae9944bff638d3f72165915d25d306dda}{
\index{usb\_\-api@{usb\_\-api}!USBDevConnect@{USBDevConnect}}
\index{USBDevConnect@{USBDevConnect}!usb_api@{usb\_\-api}}
\subsubsection[{USBDevConnect}]{\setlength{\rightskip}{0pt plus 5cm}void USBDevConnect (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gae9944bff638d3f72165915d25d306dda}
Connects the USB controller to the bus in device mode.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function will cause the soft connect feature of the USB controller to be enabled. Call USBDisconnect() to remove the USB device from the bus.

\begin{DoxyNote}{Note}
This function should only be called in device mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga973c6f78b445e39c1acf7b8bd068e764}{
\index{usb\_\-api@{usb\_\-api}!USBDevDisconnect@{USBDevDisconnect}}
\index{USBDevDisconnect@{USBDevDisconnect}!usb_api@{usb\_\-api}}
\subsubsection[{USBDevDisconnect}]{\setlength{\rightskip}{0pt plus 5cm}void USBDevDisconnect (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga973c6f78b445e39c1acf7b8bd068e764}
Removes the USB controller from the bus in device mode.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function will cause the soft connect feature of the USB controller to remove the device from the USB bus. A call to \hyperlink{group__usb__api_gae9944bff638d3f72165915d25d306dda}{USBDevConnect()} is needed to reconnect to the bus.

\begin{DoxyNote}{Note}
This function should only be called in device mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga3eb2ba5310b0c9a489ff04f56cff61da}{
\index{usb\_\-api@{usb\_\-api}!USBDevEndpointConfigGet@{USBDevEndpointConfigGet}}
\index{USBDevEndpointConfigGet@{USBDevEndpointConfigGet}!usb_api@{usb\_\-api}}
\subsubsection[{USBDevEndpointConfigGet}]{\setlength{\rightskip}{0pt plus 5cm}void USBDevEndpointConfigGet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long $\ast$}]{ pulMaxPacketSize, }
\item[{unsigned long $\ast$}]{ pulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga3eb2ba5310b0c9a489ff04f56cff61da}
Gets the current configuration for an endpoint.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em pulMaxPacketSize}]is a pointer which will be written with the maximum packet size for this endpoint. \item[{\em pulFlags}]is a pointer which will be written with the current endpoint settings. On entry to the function, this pointer must contain either {\bfseries USB\_\-EP\_\-DEV\_\-IN} or {\bfseries USB\_\-EP\_\-DEV\_\-OUT} to indicate whether the IN or OUT endpoint is to be queried.\end{DoxyParams}
This function will return the basic configuration for an endpoint in device mode. The values returned in {\itshape $\ast$pulMaxPacketSize\/} and {\itshape $\ast$pulFlags\/} are equivalent to the {\itshape ulMaxPacketSize\/} and {\itshape ulFlags\/} previously passed to \hyperlink{group__usb__api_ga15055725003cfdcd8df6e533c2c5dafc}{USBDevEndpointConfigSet()} for this endpoint.

\begin{DoxyNote}{Note}
This function should only be called in device mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga15055725003cfdcd8df6e533c2c5dafc}{
\index{usb\_\-api@{usb\_\-api}!USBDevEndpointConfigSet@{USBDevEndpointConfigSet}}
\index{USBDevEndpointConfigSet@{USBDevEndpointConfigSet}!usb_api@{usb\_\-api}}
\subsubsection[{USBDevEndpointConfigSet}]{\setlength{\rightskip}{0pt plus 5cm}void USBDevEndpointConfigSet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulMaxPacketSize, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga15055725003cfdcd8df6e533c2c5dafc}
Sets the configuration for an endpoint.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em ulMaxPacketSize}]is the maximum packet size for this endpoint. \item[{\em ulFlags}]are used to configure other endpoint settings.\end{DoxyParams}
This function will set the basic configuration for an endpoint in device mode. Endpoint zero does not have a dynamic configuration, so this function should not be called for endpoint zero. The {\itshape ulFlags\/} parameter determines some of the configuration while the other parameters provide the rest.

The {\bfseries USB\_\-EP\_\-MODE\_\-} flags define what the type is for the given endpoint.


\begin{DoxyItemize}
\item {\bfseries USB\_\-EP\_\-MODE\_\-CTRL} is a control endpoint.
\item {\bfseries USB\_\-EP\_\-MODE\_\-ISOC} is an isochronous endpoint.
\item {\bfseries USB\_\-EP\_\-MODE\_\-BULK} is a bulk endpoint.
\item {\bfseries USB\_\-EP\_\-MODE\_\-INT} is an interrupt endpoint.
\end{DoxyItemize}

The {\bfseries USB\_\-EP\_\-DMA\_\-MODE\_\-} flags determines the type of DMA access to the endpoint data FIFOs. The choice of the DMA mode depends on how the DMA controller is configured and how it is being used. See the ``Using USB with the uDMA Controller'' section for more information on DMA configuration.

When configuring an IN endpoint, the {\bfseries USB\_\-EP\_\-AUTO\_\-SET} bit can be specified to cause the automatic transmission of data on the USB bus as soon as {\itshape ulMaxPacketSize\/} bytes of data are written into the FIFO for this endpoint. This is commonly used with DMA as no interaction is required to start the transmission of data.

When configuring an OUT endpoint, the {\bfseries USB\_\-EP\_\-AUTO\_\-REQUEST} bit is specified to trigger the request for more data once the FIFO has been drained enough to receive {\itshape ulMaxPacketSize\/} more bytes of data. Also for OUT endpoints, the {\bfseries USB\_\-EP\_\-AUTO\_\-CLEAR} bit can be used to clear the data packet ready flag automatically once the data has been read from the FIFO. If this is not used, this flag must be manually cleared via a call to \hyperlink{group__usb__api_gac8b1a9f07b874f21c7019da7736ef3bc}{USBDevEndpointStatusClear()}. Both of these settings can be used to remove the need for extra calls when using the controller in DMA mode.

\begin{DoxyNote}{Note}
This function should only be called in device mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga8aa6980c19910b4bb169367591ebfc99}{
\index{usb\_\-api@{usb\_\-api}!USBDevEndpointDataAck@{USBDevEndpointDataAck}}
\index{USBDevEndpointDataAck@{USBDevEndpointDataAck}!usb_api@{usb\_\-api}}
\subsubsection[{USBDevEndpointDataAck}]{\setlength{\rightskip}{0pt plus 5cm}void USBDevEndpointDataAck (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{tBoolean}]{ bIsLastPacket}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga8aa6980c19910b4bb169367591ebfc99}
Acknowledge that data was read from the given endpoint's FIFO in device mode.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em bIsLastPacket}]indicates if this is the last packet.\end{DoxyParams}
This function acknowledges that the data was read from the endpoint's FIFO. The {\itshape bIsLastPacket\/} parameter is set to a {\bfseries true} value if this is the last in a series of data packets on endpoint zero. The {\itshape bIsLastPacket\/} parameter is not used for endpoints other than endpoint zero. This call can be used if processing is required between reading the data and acknowledging that the data has been read.

\begin{DoxyNote}{Note}
This function should only be called in device mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga9de4dbcc329487f93a98e27a34e82243}{
\index{usb\_\-api@{usb\_\-api}!USBDevEndpointStall@{USBDevEndpointStall}}
\index{USBDevEndpointStall@{USBDevEndpointStall}!usb_api@{usb\_\-api}}
\subsubsection[{USBDevEndpointStall}]{\setlength{\rightskip}{0pt plus 5cm}void USBDevEndpointStall (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga9de4dbcc329487f93a98e27a34e82243}
Stalls the specified endpoint in device mode.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]specifies the endpoint to stall. \item[{\em ulFlags}]specifies whether to stall the IN or OUT endpoint.\end{DoxyParams}
This function will cause to endpoint number passed in to go into a stall condition. If the {\itshape ulFlags\/} parameter is {\bfseries USB\_\-EP\_\-DEV\_\-IN} then the stall will be issued on the IN portion of this endpoint. If the {\itshape ulFlags\/} parameter is {\bfseries USB\_\-EP\_\-DEV\_\-OUT} then the stall will be issued on the OUT portion of this endpoint.

\begin{DoxyNote}{Note}
This function should only be called in device mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga9c38fa1ac6b9034d4c53a7099c6a9ae0}{
\index{usb\_\-api@{usb\_\-api}!USBDevEndpointStallClear@{USBDevEndpointStallClear}}
\index{USBDevEndpointStallClear@{USBDevEndpointStallClear}!usb_api@{usb\_\-api}}
\subsubsection[{USBDevEndpointStallClear}]{\setlength{\rightskip}{0pt plus 5cm}void USBDevEndpointStallClear (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga9c38fa1ac6b9034d4c53a7099c6a9ae0}
Clears the stall condition on the specified endpoint in device mode.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]specifies which endpoint to remove the stall condition. \item[{\em ulFlags}]specifies whether to remove the stall condition from the IN or the OUT portion of this endpoint.\end{DoxyParams}
This function will cause the endpoint number passed in to exit the stall condition. If the {\itshape ulFlags\/} parameter is {\bfseries USB\_\-EP\_\-DEV\_\-IN} then the stall will be cleared on the IN portion of this endpoint. If the {\itshape ulFlags\/} parameter is {\bfseries USB\_\-EP\_\-DEV\_\-OUT} then the stall will be cleared on the OUT portion of this endpoint.

\begin{DoxyNote}{Note}
This function should only be called in device mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gac8b1a9f07b874f21c7019da7736ef3bc}{
\index{usb\_\-api@{usb\_\-api}!USBDevEndpointStatusClear@{USBDevEndpointStatusClear}}
\index{USBDevEndpointStatusClear@{USBDevEndpointStatusClear}!usb_api@{usb\_\-api}}
\subsubsection[{USBDevEndpointStatusClear}]{\setlength{\rightskip}{0pt plus 5cm}void USBDevEndpointStatusClear (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gac8b1a9f07b874f21c7019da7736ef3bc}
Clears the status bits in this endpoint in device mode.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em ulFlags}]are the status bits that will be cleared.\end{DoxyParams}
This function will clear the status of any bits that are passed in the {\itshape ulFlags\/} parameter. The {\itshape ulFlags\/} parameter can take the value returned from the \hyperlink{group__usb__api_ga030910af40f5281fce288d14963496fe}{USBEndpointStatus()} call.

\begin{DoxyNote}{Note}
This function should only be called in device mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gab6030b6001c69200f951a09b02b924d7}{
\index{usb\_\-api@{usb\_\-api}!USBEndpointDataAvail@{USBEndpointDataAvail}}
\index{USBEndpointDataAvail@{USBEndpointDataAvail}!usb_api@{usb\_\-api}}
\subsubsection[{USBEndpointDataAvail}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long USBEndpointDataAvail (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gab6030b6001c69200f951a09b02b924d7}
Determine the number of bytes of data available in a given endpoint's FIFO.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access.\end{DoxyParams}
This function will return the number of bytes of data currently available in the FIFO for the given receive (OUT) endpoint. It may be used prior to calling \hyperlink{group__usb__api_ga8822f6e0cad7d22301878b475785c87e}{USBEndpointDataGet()} to determine the size of buffer required to hold the newly-\/received packet.

\begin{DoxyReturn}{Returns}
This call will return the number of bytes available in a given endpoint FIFO. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga8822f6e0cad7d22301878b475785c87e}{
\index{usb\_\-api@{usb\_\-api}!USBEndpointDataGet@{USBEndpointDataGet}}
\index{USBEndpointDataGet@{USBEndpointDataGet}!usb_api@{usb\_\-api}}
\subsubsection[{USBEndpointDataGet}]{\setlength{\rightskip}{0pt plus 5cm}long USBEndpointDataGet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned char $\ast$}]{ pucData, }
\item[{unsigned long $\ast$}]{ pulSize}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga8822f6e0cad7d22301878b475785c87e}
Retrieves data from the given endpoint's FIFO.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em pucData}]is a pointer to the data area used to return the data from the FIFO. \item[{\em pulSize}]is initially the size of the buffer passed into this call via the {\itshape pucData\/} parameter. It will be set to the amount of data returned in the buffer.\end{DoxyParams}
This function will return the data from the FIFO for the given endpoint. The {\itshape pulSize\/} parameter should indicate the size of the buffer passed in the {\itshape pulData\/} parameter. The data in the {\itshape pulSize\/} parameter will be changed to match the amount of data returned in the {\itshape pucData\/} parameter. If a zero byte packet was received this call will not return a error but will instead just return a zero in the {\itshape pulSize\/} parameter. The only error case occurs when there is no data packet available.

\begin{DoxyReturn}{Returns}
This call will return 0, or -\/1 if no packet was received. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga95b4d28e107608b288a2bc9325d7ad7c}{
\index{usb\_\-api@{usb\_\-api}!USBEndpointDataPut@{USBEndpointDataPut}}
\index{USBEndpointDataPut@{USBEndpointDataPut}!usb_api@{usb\_\-api}}
\subsubsection[{USBEndpointDataPut}]{\setlength{\rightskip}{0pt plus 5cm}long USBEndpointDataPut (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned char $\ast$}]{ pucData, }
\item[{unsigned long}]{ ulSize}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga95b4d28e107608b288a2bc9325d7ad7c}
Puts data into the given endpoint's FIFO.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em pucData}]is a pointer to the data area used as the source for the data to put into the FIFO. \item[{\em ulSize}]is the amount of data to put into the FIFO.\end{DoxyParams}
This function will put the data from the {\itshape pucData\/} parameter into the FIFO for this endpoint. If a packet is already pending for transmission then this call will not put any of the data into the FIFO and will return -\/1. Care should be taken to not write more data than can fit into the FIFO allocated by the call to USBFIFOConfig().

\begin{DoxyReturn}{Returns}
This call will return 0 on success, or -\/1 to indicate that the FIFO is in use and cannot be written. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga3c32912e36754a4f4e7c666f01dccab5}{
\index{usb\_\-api@{usb\_\-api}!USBEndpointDataSend@{USBEndpointDataSend}}
\index{USBEndpointDataSend@{USBEndpointDataSend}!usb_api@{usb\_\-api}}
\subsubsection[{USBEndpointDataSend}]{\setlength{\rightskip}{0pt plus 5cm}long USBEndpointDataSend (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulTransType}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga3c32912e36754a4f4e7c666f01dccab5}
Starts the transfer of data from an endpoint's FIFO.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em ulTransType}]is set to indicate what type of data is being sent.\end{DoxyParams}
This function will start the transfer of data from the FIFO for a given endpoint. This is necessary if the {\bfseries USB\_\-EP\_\-AUTO\_\-SET} bit was not enabled for the endpoint. Setting the {\itshape ulTransType\/} parameter will allow the appropriate signaling on the USB bus for the type of transaction being requested. The {\itshape ulTransType\/} parameter should be one of the following:


\begin{DoxyItemize}
\item USB\_\-TRANS\_\-OUT for OUT transaction on any endpoint in host mode.
\item USB\_\-TRANS\_\-IN for IN transaction on any endpoint in device mode.
\item USB\_\-TRANS\_\-IN\_\-LAST for the last IN transactions on endpoint zero in a sequence of IN transactions.
\item USB\_\-TRANS\_\-SETUP for setup transactions on endpoint zero.
\item USB\_\-TRANS\_\-STATUS for status results on endpoint zero.
\end{DoxyItemize}

\begin{DoxyReturn}{Returns}
This call will return 0 on success, or -\/1 if a transmission is already in progress. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga049dc57ea0604e549a6e632794b18ce1}{
\index{usb\_\-api@{usb\_\-api}!USBEndpointDataToggleClear@{USBEndpointDataToggleClear}}
\index{USBEndpointDataToggleClear@{USBEndpointDataToggleClear}!usb_api@{usb\_\-api}}
\subsubsection[{USBEndpointDataToggleClear}]{\setlength{\rightskip}{0pt plus 5cm}void USBEndpointDataToggleClear (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga049dc57ea0604e549a6e632794b18ce1}
Sets the Data toggle on an endpoint to zero.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]specifies the endpoint to reset the data toggle. \item[{\em ulFlags}]specifies whether to access the IN or OUT endpoint.\end{DoxyParams}
This function will cause the controller to clear the data toggle for an endpoint. This call is not valid for endpoint zero and can be made with host or device controllers.

The {\itshape ulFlags\/} parameter should be one of {\bfseries USB\_\-EP\_\-HOST\_\-OUT}, {\bfseries USB\_\-EP\_\-HOST\_\-IN}, {\bfseries USB\_\-EP\_\-DEV\_\-OUT}, or {\bfseries USB\_\-EP\_\-DEV\_\-IN}.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gabd41bc3471a0277bfcbe743019fa7b06}{
\index{usb\_\-api@{usb\_\-api}!USBEndpointDMAChannel@{USBEndpointDMAChannel}}
\index{USBEndpointDMAChannel@{USBEndpointDMAChannel}!usb_api@{usb\_\-api}}
\subsubsection[{USBEndpointDMAChannel}]{\setlength{\rightskip}{0pt plus 5cm}void USBEndpointDMAChannel (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulChannel}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gabd41bc3471a0277bfcbe743019fa7b06}
Sets the DMA channel to use for a given endpoint.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]specifies which endpoint's FIFO address to return. \item[{\em ulChannel}]specifies which DMA channel to use for which endpoint.\end{DoxyParams}
This function is used to configure which DMA channel to use with a given endpoint. Receive DMA channels can only be used with receive endpoints and transmit DMA channels can only be used with transmit endpoints. This allows the 3 receive and 3 transmit DMA channels to be mapped to any endpoint other than 0. The values that should be passed into the {\itshape ulChannel\/} value are the UDMA\_\-CHANNEL\_\-USBEP$\ast$ values defined in \hyperlink{udma_8h_source}{udma.h}.

\begin{DoxyNote}{Note}
This function only has an effect on microcontrollers that have the ability to change the DMA channel for an endpoint. Calling this function on other devices will have no effect.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga6c4dbeca3addcf3dbee3bf9b68f6f8fb}{
\index{usb\_\-api@{usb\_\-api}!USBEndpointDMADisable@{USBEndpointDMADisable}}
\index{USBEndpointDMADisable@{USBEndpointDMADisable}!usb_api@{usb\_\-api}}
\subsubsection[{USBEndpointDMADisable}]{\setlength{\rightskip}{0pt plus 5cm}void USBEndpointDMADisable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga6c4dbeca3addcf3dbee3bf9b68f6f8fb}
Disable DMA on a given endpoint.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em ulFlags}]specifies which direction to disable.\end{DoxyParams}
This function will disable DMA on a given end point to allow non-\/DMA USB transactions to generate interrupts normally. The ulFlags should be {\bfseries USB\_\-EP\_\-DEV\_\-IN} or {\bfseries USB\_\-EP\_\-DEV\_\-OUT} all other bits are ignored.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gaaf638b1dd57ccc96e0cd1f8734f4adf9}{
\index{usb\_\-api@{usb\_\-api}!USBEndpointDMAEnable@{USBEndpointDMAEnable}}
\index{USBEndpointDMAEnable@{USBEndpointDMAEnable}!usb_api@{usb\_\-api}}
\subsubsection[{USBEndpointDMAEnable}]{\setlength{\rightskip}{0pt plus 5cm}void USBEndpointDMAEnable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gaaf638b1dd57ccc96e0cd1f8734f4adf9}
Enable DMA on a given endpoint.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em ulFlags}]specifies which direction and what mode to use when enabling DMA.\end{DoxyParams}
This function will enable DMA on a given endpoint and set the mode according to the values in the {\itshape ulFlags\/} parameter. The {\itshape ulFlags\/} parameter should have {\bfseries USB\_\-EP\_\-DEV\_\-IN} or {\bfseries USB\_\-EP\_\-DEV\_\-OUT} set.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga030910af40f5281fce288d14963496fe}{
\index{usb\_\-api@{usb\_\-api}!USBEndpointStatus@{USBEndpointStatus}}
\index{USBEndpointStatus@{USBEndpointStatus}!usb_api@{usb\_\-api}}
\subsubsection[{USBEndpointStatus}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long USBEndpointStatus (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga030910af40f5281fce288d14963496fe}
Returns the current status of an endpoint.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access.\end{DoxyParams}
This function will return the status of a given endpoint. If any of these status bits need to be cleared, then these these values must be cleared by calling the \hyperlink{group__usb__api_gac8b1a9f07b874f21c7019da7736ef3bc}{USBDevEndpointStatusClear()} or \hyperlink{group__usb__api_ga91480530ccd4a90d62c8da7e06d5f9bc}{USBHostEndpointStatusClear()} functions.

The following are the status flags for host mode:


\begin{DoxyItemize}
\item {\bfseries USB\_\-HOST\_\-IN\_\-PID\_\-ERROR} -\/ PID error on the given endpoint.
\item {\bfseries USB\_\-HOST\_\-IN\_\-NOT\_\-COMP} -\/ The device failed to respond to an IN request.
\item {\bfseries USB\_\-HOST\_\-IN\_\-STALL} -\/ A stall was received on an IN endpoint.
\item {\bfseries USB\_\-HOST\_\-IN\_\-DATA\_\-ERROR} -\/ There was a CRC or bit-\/stuff error on an IN endpoint in Isochronous mode.
\item {\bfseries USB\_\-HOST\_\-IN\_\-NAK\_\-TO} -\/ NAKs received on this IN endpoint for more than the specified timeout period.
\item {\bfseries USB\_\-HOST\_\-IN\_\-ERROR} -\/ Failed to communicate with a device using this IN endpoint.
\item {\bfseries USB\_\-HOST\_\-IN\_\-FIFO\_\-FULL} -\/ This IN endpoint's FIFO is full.
\item {\bfseries USB\_\-HOST\_\-IN\_\-PKTRDY} -\/ Data packet ready on this IN endpoint.
\item {\bfseries USB\_\-HOST\_\-OUT\_\-NAK\_\-TO} -\/ NAKs received on this OUT endpoint for more than the specified timeout period.
\item {\bfseries USB\_\-HOST\_\-OUT\_\-NOT\_\-COMP} -\/ The device failed to respond to an OUT request.
\item {\bfseries USB\_\-HOST\_\-OUT\_\-STALL} -\/ A stall was received on this OUT endpoint.
\item {\bfseries USB\_\-HOST\_\-OUT\_\-ERROR} -\/ Failed to communicate with a device using this OUT endpoint.
\item {\bfseries USB\_\-HOST\_\-OUT\_\-FIFO\_\-NE} -\/ This endpoint's OUT FIFO is not empty.
\item {\bfseries USB\_\-HOST\_\-OUT\_\-PKTPEND} -\/ The data transfer on this OUT endpoint has not completed.
\item {\bfseries USB\_\-HOST\_\-EP0\_\-NAK\_\-TO} -\/ NAKs received on endpoint zero for more than the specified timeout period.
\item {\bfseries USB\_\-HOST\_\-EP0\_\-ERROR} -\/ The device failed to respond to a request on endpoint zero.
\item {\bfseries USB\_\-HOST\_\-EP0\_\-IN\_\-STALL} -\/ A stall was received on endpoint zero for an IN transaction.
\item {\bfseries USB\_\-HOST\_\-EP0\_\-IN\_\-PKTRDY} -\/ Data packet ready on endpoint zero for an IN transaction.
\end{DoxyItemize}

The following are the status flags for device mode:


\begin{DoxyItemize}
\item {\bfseries USB\_\-DEV\_\-OUT\_\-SENT\_\-STALL} -\/ A stall was sent on this OUT endpoint.
\item {\bfseries USB\_\-DEV\_\-OUT\_\-DATA\_\-ERROR} -\/ There was a CRC or bit-\/stuff error on an OUT endpoint.
\item {\bfseries USB\_\-DEV\_\-OUT\_\-OVERRUN} -\/ An OUT packet was not loaded due to a full FIFO.
\item {\bfseries USB\_\-DEV\_\-OUT\_\-FIFO\_\-FULL} -\/ The OUT endpoint's FIFO is full.
\item {\bfseries USB\_\-DEV\_\-OUT\_\-PKTRDY} -\/ There is a data packet ready in the OUT endpoint's FIFO.
\item {\bfseries USB\_\-DEV\_\-IN\_\-NOT\_\-COMP} -\/ A larger packet was split up, more data to come.
\item {\bfseries USB\_\-DEV\_\-IN\_\-SENT\_\-STALL} -\/ A stall was sent on this IN endpoint.
\item {\bfseries USB\_\-DEV\_\-IN\_\-UNDERRUN} -\/ Data was requested on the IN endpoint and no data was ready.
\item {\bfseries USB\_\-DEV\_\-IN\_\-FIFO\_\-NE} -\/ The IN endpoint's FIFO is not empty.
\item {\bfseries USB\_\-DEV\_\-IN\_\-PKTPEND} -\/ The data transfer on this IN endpoint has not completed.
\item {\bfseries USB\_\-DEV\_\-EP0\_\-SETUP\_\-END} -\/ A control transaction ended before Data End condition was sent.
\item {\bfseries USB\_\-DEV\_\-EP0\_\-SENT\_\-STALL} -\/ A stall was sent on endpoint zero.
\item {\bfseries USB\_\-DEV\_\-EP0\_\-IN\_\-PKTPEND} -\/ The data transfer on endpoint zero has not completed.
\item {\bfseries USB\_\-DEV\_\-EP0\_\-OUT\_\-PKTRDY} -\/ There is a data packet ready in endpoint zero's OUT FIFO.
\end{DoxyItemize}

\begin{DoxyReturn}{Returns}
The current status flags for the endpoint depending on mode. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gab4c5b6b760d2e0a74c791bd6648cc780}{
\index{usb\_\-api@{usb\_\-api}!USBFIFOAddrGet@{USBFIFOAddrGet}}
\index{USBFIFOAddrGet@{USBFIFOAddrGet}!usb_api@{usb\_\-api}}
\subsubsection[{USBFIFOAddrGet}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long USBFIFOAddrGet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gab4c5b6b760d2e0a74c791bd6648cc780}
Returns the absolute FIFO address for a given endpoint.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]specifies which endpoint's FIFO address to return.\end{DoxyParams}
This function returns the actual physical address of the FIFO. This is needed when the USB is going to be used with the uDMA controller and the source or destination address needs to be set to the physical FIFO address for a given endpoint.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gaeb3b6b1ac6a999b23db4925d5dda6fa2}{
\index{usb\_\-api@{usb\_\-api}!USBFIFOConfigGet@{USBFIFOConfigGet}}
\index{USBFIFOConfigGet@{USBFIFOConfigGet}!usb_api@{usb\_\-api}}
\subsubsection[{USBFIFOConfigGet}]{\setlength{\rightskip}{0pt plus 5cm}void USBFIFOConfigGet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long $\ast$}]{ pulFIFOAddress, }
\item[{unsigned long $\ast$}]{ pulFIFOSize, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gaeb3b6b1ac6a999b23db4925d5dda6fa2}
Returns the FIFO configuration for an endpoint.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em pulFIFOAddress}]is the starting address for the FIFO. \item[{\em pulFIFOSize}]is the size of the FIFO in bytes. \item[{\em ulFlags}]specifies what information to retrieve from the FIFO configuration.\end{DoxyParams}
This function will return the starting address and size of the FIFO for a given endpoint. Endpoint zero does not have a dynamically configurable FIFO so this function should not be called for endpoint zero. The {\itshape ulFlags\/} parameter specifies whether the endpoint's OUT or IN FIFO should be read. If in host mode, the {\itshape ulFlags\/} parameter should be {\bfseries USB\_\-EP\_\-HOST\_\-OUT} or {\bfseries USB\_\-EP\_\-HOST\_\-IN}, and if in device mode the {\itshape ulFlags\/} parameter should be either {\bfseries USB\_\-EP\_\-DEV\_\-OUT} or {\bfseries USB\_\-EP\_\-DEV\_\-IN}.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gaf3ebf886ffebb5fc04d8299d22bb16ab}{
\index{usb\_\-api@{usb\_\-api}!USBFIFOConfigSet@{USBFIFOConfigSet}}
\index{USBFIFOConfigSet@{USBFIFOConfigSet}!usb_api@{usb\_\-api}}
\subsubsection[{USBFIFOConfigSet}]{\setlength{\rightskip}{0pt plus 5cm}void USBFIFOConfigSet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulFIFOAddress, }
\item[{unsigned long}]{ ulFIFOSize, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gaf3ebf886ffebb5fc04d8299d22bb16ab}
Sets the FIFO configuration for an endpoint.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em ulFIFOAddress}]is the starting address for the FIFO. \item[{\em ulFIFOSize}]is the size of the FIFO in bytes. \item[{\em ulFlags}]specifies what information to set in the FIFO configuration.\end{DoxyParams}
This function will set the starting FIFO RAM address and size of the FIFO for a given endpoint. Endpoint zero does not have a dynamically configurable FIFO so this function should not be called for endpoint zero. The {\itshape ulFIFOSize\/} parameter should be one of the values in the {\bfseries USB\_\-FIFO\_\-SZ\_\-} values. If the endpoint is going to use double buffering it should use the values with the {\bfseries \_\-DB} at the end of the value. For example, use {\bfseries USB\_\-FIFO\_\-SZ\_\-16\_\-DB} to configure an endpoint to have a 16 byte double buffered FIFO. If a double buffered FIFO is used, then the actual size of the FIFO will be twice the size indicated by the {\itshape ulFIFOSize\/} parameter. This means that the {\bfseries USB\_\-FIFO\_\-SZ\_\-16\_\-DB} value will use 32 bytes of the USB controller's FIFO memory.

The {\itshape ulFIFOAddress\/} value should be a multiple of 8 bytes and directly indicates the starting address in the USB controller's FIFO RAM. For example, a value of 64 indicates that the FIFO should start 64 bytes into the USB controller's FIFO memory. The {\itshape ulFlags\/} value specifies whether the endpoint's OUT or IN FIFO should be configured. If in host mode, use {\bfseries USB\_\-EP\_\-HOST\_\-OUT} or {\bfseries USB\_\-EP\_\-HOST\_\-IN}, and if in device mode use {\bfseries USB\_\-EP\_\-DEV\_\-OUT} or {\bfseries USB\_\-EP\_\-DEV\_\-IN}.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga40c0313238896b15cb08c5af6415930f}{
\index{usb\_\-api@{usb\_\-api}!USBFIFOFlush@{USBFIFOFlush}}
\index{USBFIFOFlush@{USBFIFOFlush}!usb_api@{usb\_\-api}}
\subsubsection[{USBFIFOFlush}]{\setlength{\rightskip}{0pt plus 5cm}void USBFIFOFlush (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga40c0313238896b15cb08c5af6415930f}
Forces a flush of an endpoint's FIFO.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em ulFlags}]specifies if the IN or OUT endpoint should be accessed.\end{DoxyParams}
This function will force the controller to flush out the data in the FIFO. The function can be called with either host or device controllers and requires the {\itshape ulFlags\/} parameter be one of {\bfseries USB\_\-EP\_\-HOST\_\-OUT}, {\bfseries USB\_\-EP\_\-HOST\_\-IN}, {\bfseries USB\_\-EP\_\-DEV\_\-OUT}, or {\bfseries USB\_\-EP\_\-DEV\_\-IN}.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gaf71e5390559256c1acef164d7a19d31b}{
\index{usb\_\-api@{usb\_\-api}!USBFrameNumberGet@{USBFrameNumberGet}}
\index{USBFrameNumberGet@{USBFrameNumberGet}!usb_api@{usb\_\-api}}
\subsubsection[{USBFrameNumberGet}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long USBFrameNumberGet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gaf71e5390559256c1acef164d7a19d31b}
Get the current frame number.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function returns the last frame number received.

\begin{DoxyReturn}{Returns}
The last frame number received. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gad87853e0cab3b6468b8a4df0cfe815a9}{
\index{usb\_\-api@{usb\_\-api}!USBHostAddrGet@{USBHostAddrGet}}
\index{USBHostAddrGet@{USBHostAddrGet}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostAddrGet}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long USBHostAddrGet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gad87853e0cab3b6468b8a4df0cfe815a9}
Gets the current functional device address for an endpoint.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em ulFlags}]determines if this is an IN or an OUT endpoint.\end{DoxyParams}
This function returns the current functional address that an endpoint is using to communicate with a device. The {\itshape ulFlags\/} parameter determines if the IN or OUT endpoint's device address is returned.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Returns the current function address being used by an endpoint. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gac63fff267fe53846275e0812d170c3f3}{
\index{usb\_\-api@{usb\_\-api}!USBHostAddrSet@{USBHostAddrSet}}
\index{USBHostAddrSet@{USBHostAddrSet}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostAddrSet}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostAddrSet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulAddr, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gac63fff267fe53846275e0812d170c3f3}
Sets the functional address for the device that is connected to an endpoint in host mode.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em ulAddr}]is the functional address for the controller to use for this endpoint. \item[{\em ulFlags}]determines if this is an IN or an OUT endpoint.\end{DoxyParams}
This function will set the functional address for a device that is using this endpoint for communication. This {\itshape ulAddr\/} parameter is the address of the target device that this endpoint will be used to communicate with. The {\itshape ulFlags\/} parameter indicates if the IN or OUT endpoint should be set.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga6aa974855c1640bb3773ab0ab711facb}{
\index{usb\_\-api@{usb\_\-api}!USBHostEndpointConfig@{USBHostEndpointConfig}}
\index{USBHostEndpointConfig@{USBHostEndpointConfig}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostEndpointConfig}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostEndpointConfig (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulMaxPayload, }
\item[{unsigned long}]{ ulNAKPollInterval, }
\item[{unsigned long}]{ ulTargetEndpoint, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga6aa974855c1640bb3773ab0ab711facb}
Sets the base configuration for a host endpoint.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em ulMaxPayload}]is the maximum payload for this endpoint. \item[{\em ulNAKPollInterval}]is the either the NAK timeout limit or the polling interval depending on the type of endpoint. \item[{\em ulTargetEndpoint}]is the endpoint that the host endpoint is targeting. \item[{\em ulFlags}]are used to configure other endpoint settings.\end{DoxyParams}
This function will set the basic configuration for the transmit or receive portion of an endpoint in host mode. The {\itshape ulFlags\/} parameter determines some of the configuration while the other parameters provide the rest. The {\itshape ulFlags\/} parameter determines whether this is an IN endpoint (USB\_\-EP\_\-HOST\_\-IN or USB\_\-EP\_\-DEV\_\-IN) or an OUT endpoint (USB\_\-EP\_\-HOST\_\-OUT or USB\_\-EP\_\-DEV\_\-OUT), whether this is a Full speed endpoint (USB\_\-EP\_\-SPEED\_\-FULL) or a Low speed endpoint (USB\_\-EP\_\-SPEED\_\-LOW).

The {\bfseries USB\_\-EP\_\-MODE\_\-} flags control the type of the endpoint.
\begin{DoxyItemize}
\item {\bfseries USB\_\-EP\_\-MODE\_\-CTRL} is a control endpoint.
\item {\bfseries USB\_\-EP\_\-MODE\_\-ISOC} is an isochronous endpoint.
\item {\bfseries USB\_\-EP\_\-MODE\_\-BULK} is a bulk endpoint.
\item {\bfseries USB\_\-EP\_\-MODE\_\-INT} is an interrupt endpoint.
\end{DoxyItemize}

The {\itshape ulNAKPollInterval\/} parameter has different meanings based on the {\bfseries USB\_\-EP\_\-MODE} value and whether or not this call is being made for endpoint zero or another endpoint. For endpoint zero or any Bulk endpoints, this value always indicates the number of frames to allow a device to NAK before considering it a timeout. If this endpoint is an isochronous or interrupt endpoint, this value is the polling interval for this endpoint.

For interrupt endpoints the polling interval is simply the number of frames between polling an interrupt endpoint. For isochronous endpoints this value represents a polling interval of 2 $^\wedge$ ({\itshape ulNAKPollInterval\/} -\/ 1) frames. When used as a NAK timeout, the {\itshape ulNAKPollInterval\/} value specifies 2 $^\wedge$ ({\itshape ulNAKPollInterval\/} -\/ 1) frames before issuing a time out. There are two special time out values that can be specified when setting the {\itshape ulNAKPollInterval\/} value. The first is {\bfseries MAX\_\-NAK\_\-LIMIT} which is the maximum value that can be passed in this variable. The other is {\bfseries DISABLE\_\-NAK\_\-LIMIT} which indicates that there should be no limit on the number of NAKs.

The {\bfseries USB\_\-EP\_\-DMA\_\-MODE\_\-} flags enables the type of DMA used to access the endpoint's data FIFOs. The choice of the DMA mode depends on how the DMA controller is configured and how it is being used. See the ``Using USB with the uDMA Controller'' section for more information on DMA configuration.

When configuring the OUT portion of an endpoint, the {\bfseries USB\_\-EP\_\-AUTO\_\-SET} bit is specified to cause the transmission of data on the USB bus to start as soon as the number of bytes specified by {\itshape ulMaxPayload\/} have been written into the OUT FIFO for this endpoint.

When configuring the IN portion of an endpoint, the {\bfseries USB\_\-EP\_\-AUTO\_\-REQUEST} bit can be specified to trigger the request for more data once the FIFO has been drained enough to fit {\itshape ulMaxPayload\/} bytes. The {\bfseries USB\_\-EP\_\-AUTO\_\-CLEAR} bit can be used to clear the data packet ready flag automatically once the data has been read from the FIFO. If this is not used, this flag must be manually cleared via a call to \hyperlink{group__usb__api_gac8b1a9f07b874f21c7019da7736ef3bc}{USBDevEndpointStatusClear()} or \hyperlink{group__usb__api_ga91480530ccd4a90d62c8da7e06d5f9bc}{USBHostEndpointStatusClear()}.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gab69d6597394838de529b7f26f448f76a}{
\index{usb\_\-api@{usb\_\-api}!USBHostEndpointDataAck@{USBHostEndpointDataAck}}
\index{USBHostEndpointDataAck@{USBHostEndpointDataAck}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostEndpointDataAck}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostEndpointDataAck (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gab69d6597394838de529b7f26f448f76a}
Acknowledge that data was read from the given endpoint's FIFO in host mode.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access.\end{DoxyParams}
This function acknowledges that the data was read from the endpoint's FIFO. This call is used if processing is required between reading the data and acknowledging that the data has been read.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga46015457955456164c5d28ce0eb9361f}{
\index{usb\_\-api@{usb\_\-api}!USBHostEndpointDataToggle@{USBHostEndpointDataToggle}}
\index{USBHostEndpointDataToggle@{USBHostEndpointDataToggle}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostEndpointDataToggle}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostEndpointDataToggle (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{tBoolean}]{ bDataToggle, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga46015457955456164c5d28ce0eb9361f}
Sets the value data toggle on an endpoint in host mode.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]specifies the endpoint to reset the data toggle. \item[{\em bDataToggle}]specifies whether to set the state to DATA0 or DATA1. \item[{\em ulFlags}]specifies whether to set the IN or OUT endpoint.\end{DoxyParams}
This function is used to force the state of the data toggle in host mode. If the value passed in the {\itshape bDataToggle\/} parameter is {\bfseries false}, then the data toggle will be set to the DATA0 state, and if it is {\bfseries true} it will be set to the DATA1 state. The {\itshape ulFlags\/} parameter can be {\bfseries USB\_\-EP\_\-HOST\_\-IN} or {\bfseries USB\_\-EP\_\-HOST\_\-OUT} to access the desired portion of this endpoint. The {\itshape ulFlags\/} parameter is ignored for endpoint zero.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga91480530ccd4a90d62c8da7e06d5f9bc}{
\index{usb\_\-api@{usb\_\-api}!USBHostEndpointStatusClear@{USBHostEndpointStatusClear}}
\index{USBHostEndpointStatusClear@{USBHostEndpointStatusClear}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostEndpointStatusClear}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostEndpointStatusClear (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga91480530ccd4a90d62c8da7e06d5f9bc}
Clears the status bits in this endpoint in host mode.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em ulFlags}]are the status bits that will be cleared.\end{DoxyParams}
This function will clear the status of any bits that are passed in the {\itshape ulFlags\/} parameter. The {\itshape ulFlags\/} parameter can take the value returned from the \hyperlink{group__usb__api_ga030910af40f5281fce288d14963496fe}{USBEndpointStatus()} call.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga7f085d399f209190e157ae5d9163957e}{
\index{usb\_\-api@{usb\_\-api}!USBHostHubAddrGet@{USBHostHubAddrGet}}
\index{USBHostHubAddrGet@{USBHostHubAddrGet}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostHubAddrGet}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long USBHostHubAddrGet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga7f085d399f209190e157ae5d9163957e}
Get the current device hub address for this endpoint.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em ulFlags}]determines if this is an IN or an OUT endpoint.\end{DoxyParams}
This function will return the current hub address that an endpoint is using to communicate with a device. The {\itshape ulFlags\/} parameter determines if the device address for the IN or OUT endpoint is returned.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
This function returns the current hub address being used by an endpoint. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga9f1504e02063b617ce64ccc1f52ad4d8}{
\index{usb\_\-api@{usb\_\-api}!USBHostHubAddrSet@{USBHostHubAddrSet}}
\index{USBHostHubAddrSet@{USBHostHubAddrSet}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostHubAddrSet}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostHubAddrSet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint, }
\item[{unsigned long}]{ ulAddr, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga9f1504e02063b617ce64ccc1f52ad4d8}
Set the hub address for the device that is connected to an endpoint.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access. \item[{\em ulAddr}]is the hub address for the device using this endpoint. \item[{\em ulFlags}]determines if this is an IN or an OUT endpoint.\end{DoxyParams}
This function will set the hub address for a device that is using this endpoint for communication. The {\itshape ulFlags\/} parameter determines if the device address for the IN or the OUT endpoint is set by this call.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga9ad32d39a6455f24b18fba0cd20e6478}{
\index{usb\_\-api@{usb\_\-api}!USBHostMode@{USBHostMode}}
\index{USBHostMode@{USBHostMode}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostMode}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostMode (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga9ad32d39a6455f24b18fba0cd20e6478}
Change the mode of the USB controller to host.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function changes the mode of the USB controller to host mode. This is only valid on microcontrollers that have the host and device capabilities and not the OTG capabilities.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gaa9391409fc826c386b8832aa5bd06d33}{
\index{usb\_\-api@{usb\_\-api}!USBHostPwrConfig@{USBHostPwrConfig}}
\index{USBHostPwrConfig@{USBHostPwrConfig}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostPwrConfig}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostPwrConfig (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gaa9391409fc826c386b8832aa5bd06d33}
Sets the configuration for USB power fault.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulFlags}]specifies the configuration of the power fault.\end{DoxyParams}
This function controls how the USB controller uses its external power control pins(USBnPFTL and USBnEPEN). The flags specify the power fault level sensitivity, the power fault action, and the power enable level and source.

One of the following can be selected as the power fault level sensitivity:


\begin{DoxyItemize}
\item {\bfseries USB\_\-HOST\_\-PWRFLT\_\-LOW} -\/ An external power fault is indicated by the pin being driven low.
\item {\bfseries USB\_\-HOST\_\-PWRFLT\_\-HIGH} -\/ An external power fault is indicated by the pin being driven high.
\end{DoxyItemize}

One of the following can be selected as the power fault action:


\begin{DoxyItemize}
\item {\bfseries USB\_\-HOST\_\-PWRFLT\_\-EP\_\-NONE} -\/ No automatic action when power fault detected.
\item {\bfseries USB\_\-HOST\_\-PWRFLT\_\-EP\_\-TRI} -\/ Automatically Tri-\/state the USBnEPEN pin on a power fault.
\item {\bfseries USB\_\-HOST\_\-PWRFLT\_\-EP\_\-LOW} -\/ Automatically drive USBnEPEN pin low on a power fault.
\item {\bfseries USB\_\-HOST\_\-PWRFLT\_\-EP\_\-HIGH} -\/ Automatically drive USBnEPEN pin high on a power fault.
\end{DoxyItemize}

One of the following can be selected as the power enable level and source:


\begin{DoxyItemize}
\item {\bfseries USB\_\-HOST\_\-PWREN\_\-MAN\_\-LOW} -\/ USBEPEN is driven low by the USB controller when \hyperlink{group__usb__api_ga42edf6615bf04517c23d855c9bc2306b}{USBHostPwrEnable()} is called.
\item {\bfseries USB\_\-HOST\_\-PWREN\_\-MAN\_\-HIGH} -\/ USBEPEN is driven high by the USB controller when \hyperlink{group__usb__api_ga42edf6615bf04517c23d855c9bc2306b}{USBHostPwrEnable()} is called.
\item {\bfseries USB\_\-HOST\_\-PWREN\_\-AUTOLOW} -\/ USBEPEN is driven low by the USB controller automatically if \hyperlink{group__usb__api_ga048c5620ed2d97e02b1f96c10dcd8e9f}{USBOTGSessionRequest()} has enabled a session.
\item {\bfseries USB\_\-HOST\_\-PWREN\_\-AUTOHIGH} -\/ USBEPEN is driven high by the USB controller automatically if \hyperlink{group__usb__api_ga048c5620ed2d97e02b1f96c10dcd8e9f}{USBOTGSessionRequest()} has enabled a session.
\end{DoxyItemize}

On devices that support the VBUS glitch filter, the {\bfseries USB\_\-HOST\_\-PWREN\_\-FILTER} can be added to ignore small short drops in VBUS level caused by high power consumption. This is mainly used to avoid causing VBUS errors caused by devices with high in-\/rush current.

\begin{DoxyNote}{Note}
The following values have been deprecated and should no longer be used.
\begin{DoxyItemize}
\item {\bfseries USB\_\-HOST\_\-PWREN\_\-LOW} -\/ Automatically drive USBnEPEN low when power is enabled.
\item {\bfseries USB\_\-HOST\_\-PWREN\_\-HIGH} -\/ Automatically drive USBnEPEN high when power is enabled.
\item {\bfseries USB\_\-HOST\_\-PWREN\_\-VBLOW} -\/ Automatically drive USBnEPEN low when power is enabled.
\item {\bfseries USB\_\-HOST\_\-PWREN\_\-VBHIGH} -\/ Automatically drive USBnEPEN high when power is enabled.
\end{DoxyItemize}

This function should only be called on microcontrollers that support host mode or OTG operation.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga89ba4fe30d67d75a2b3f4fb8843345ab}{
\index{usb\_\-api@{usb\_\-api}!USBHostPwrDisable@{USBHostPwrDisable}}
\index{USBHostPwrDisable@{USBHostPwrDisable}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostPwrDisable}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostPwrDisable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga89ba4fe30d67d75a2b3f4fb8843345ab}
Disables the external power pin.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function disables the USBEPEN signal to disable an external power supply in host mode operation.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga42edf6615bf04517c23d855c9bc2306b}{
\index{usb\_\-api@{usb\_\-api}!USBHostPwrEnable@{USBHostPwrEnable}}
\index{USBHostPwrEnable@{USBHostPwrEnable}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostPwrEnable}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostPwrEnable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga42edf6615bf04517c23d855c9bc2306b}
Enables the external power pin.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function enables the USBEPEN signal to enable an external power supply in host mode operation.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga6d8caaf60d312428973e917abafb7165}{
\index{usb\_\-api@{usb\_\-api}!USBHostPwrFaultDisable@{USBHostPwrFaultDisable}}
\index{USBHostPwrFaultDisable@{USBHostPwrFaultDisable}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostPwrFaultDisable}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostPwrFaultDisable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga6d8caaf60d312428973e917abafb7165}
Disables power fault detection.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function disables power fault detection in the USB controller.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gad38b77c7eadac8f0fa6872ecc487594b}{
\index{usb\_\-api@{usb\_\-api}!USBHostPwrFaultEnable@{USBHostPwrFaultEnable}}
\index{USBHostPwrFaultEnable@{USBHostPwrFaultEnable}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostPwrFaultEnable}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostPwrFaultEnable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gad38b77c7eadac8f0fa6872ecc487594b}
Enables power fault detection.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function enables power fault detection in the USB controller. If the USBPFLT pin is not in use this function should not be used.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gab2c766b82a33c3db7b98c84e597c368b}{
\index{usb\_\-api@{usb\_\-api}!USBHostRequestIN@{USBHostRequestIN}}
\index{USBHostRequestIN@{USBHostRequestIN}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostRequestIN}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostRequestIN (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEndpoint}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gab2c766b82a33c3db7b98c84e597c368b}
Schedules a request for an IN transaction on an endpoint in host mode.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulEndpoint}]is the endpoint to access.\end{DoxyParams}
This function will schedule a request for an IN transaction. When the USB device being communicated with responds the data, the data can be retrieved by calling \hyperlink{group__usb__api_ga8822f6e0cad7d22301878b475785c87e}{USBEndpointDataGet()} or via a DMA transfer.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga07b3554cea8cbae9a816ff726eea9fc6}{
\index{usb\_\-api@{usb\_\-api}!USBHostRequestStatus@{USBHostRequestStatus}}
\index{USBHostRequestStatus@{USBHostRequestStatus}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostRequestStatus}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostRequestStatus (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga07b3554cea8cbae9a816ff726eea9fc6}
Issues a request for a status IN transaction on endpoint zero.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function is used to cause a request for an status IN transaction from a device on endpoint zero. This function can only be used with endpoint zero as that is the only control endpoint that supports this ability. This is used to complete the last phase of a control transaction to a device and an interrupt will be signaled when the status packet has been received.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gaeb924eb6327a04c66e944848bddd84b5}{
\index{usb\_\-api@{usb\_\-api}!USBHostReset@{USBHostReset}}
\index{USBHostReset@{USBHostReset}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostReset}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostReset (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{tBoolean}]{ bStart}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gaeb924eb6327a04c66e944848bddd84b5}
Handles the USB bus reset condition.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em bStart}]specifies whether to start or stop signaling reset on the USB bus.\end{DoxyParams}
When this function is called with the {\itshape bStart\/} parameter set to {\bfseries true}, this function will cause the start of a reset condition on the USB bus. The caller should then delay at least 20ms before calling this function again with the {\itshape bStart\/} parameter set to {\bfseries false}.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gaf5c998ca2cba236d8ab11dcbff267023}{
\index{usb\_\-api@{usb\_\-api}!USBHostResume@{USBHostResume}}
\index{USBHostResume@{USBHostResume}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostResume}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostResume (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{tBoolean}]{ bStart}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gaf5c998ca2cba236d8ab11dcbff267023}
Handles the USB bus resume condition.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em bStart}]specifies if the USB controller is entering or leaving the resume signaling state.\end{DoxyParams}
When in device mode this function will bring the USB controller out of the suspend state. This call should first be made with the {\itshape bStart\/} parameter set to {\bfseries true} to start resume signaling. The device application should then delay at least 10ms but not more than 15ms before calling this function with the {\itshape bStart\/} parameter set to {\bfseries false}.

When in host mode this function will signal devices to leave the suspend state. This call should first be made with the {\itshape bStart\/} parameter set to {\bfseries true} to start resume signaling. The host application should then delay at least 20ms before calling this function with the {\itshape bStart\/} parameter set to {\bfseries false}. This will cause the controller to complete the resume signaling on the USB bus.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gaa695facd945c1bcdafe8f3b722e88071}{
\index{usb\_\-api@{usb\_\-api}!USBHostSpeedGet@{USBHostSpeedGet}}
\index{USBHostSpeedGet@{USBHostSpeedGet}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostSpeedGet}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long USBHostSpeedGet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gaa695facd945c1bcdafe8f3b722e88071}
Returns the current speed of the USB device connected.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function will return the current speed of the USB bus.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Returns either {\bfseries USB\_\-LOW\_\-SPEED}, {\bfseries USB\_\-FULL\_\-SPEED}, or {\bfseries USB\_\-UNDEF\_\-SPEED}. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga0845c547b9d4d8f7025b4623ad701d2e}{
\index{usb\_\-api@{usb\_\-api}!USBHostSuspend@{USBHostSuspend}}
\index{USBHostSuspend@{USBHostSuspend}!usb_api@{usb\_\-api}}
\subsubsection[{USBHostSuspend}]{\setlength{\rightskip}{0pt plus 5cm}void USBHostSuspend (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga0845c547b9d4d8f7025b4623ad701d2e}
Puts the USB bus in a suspended state.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
When used in host mode, this function will put the USB bus in the suspended state.

\begin{DoxyNote}{Note}
This function should only be called in host mode.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gabf639c393de9dc884e0b6b62b5dcb938}{
\index{usb\_\-api@{usb\_\-api}!USBIntDisable@{USBIntDisable}}
\index{USBIntDisable@{USBIntDisable}!usb_api@{usb\_\-api}}
\subsubsection[{USBIntDisable}]{\setlength{\rightskip}{0pt plus 5cm}void USBIntDisable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gabf639c393de9dc884e0b6b62b5dcb938}
Disables the sources for USB interrupts.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulFlags}]specifies which interrupts to disable.\end{DoxyParams}
This function will disable the USB controller from generating the interrupts indicated by the {\itshape ulFlags\/} parameter. There are three groups of interrupt sources, IN Endpoints, OUT Endpoints, and general status changes, specified by {\bfseries USB\_\-INT\_\-HOST\_\-IN}, {\bfseries USB\_\-INT\_\-HOST\_\-OUT}, {\bfseries USB\_\-INT\_\-DEV\_\-IN}, {\bfseries USB\_\-INT\_\-DEV\_\-OUT}, and {\bfseries USB\_\-INT\_\-STATUS}. If {\bfseries USB\_\-INT\_\-ALL} is specified then all interrupts will be disabled.

\begin{DoxyNote}{Note}
WARNING: This API cannot be used on endpoint numbers greater than endpoint 3 so \hyperlink{group__usb__api_ga9064db5f49a1fd7cd3dbf02309c8c254}{USBIntDisableControl()} or \hyperlink{group__usb__api_ga413bae5d18d8c6fd4be4bdabdb0172e9}{USBIntDisableEndpoint()} should be used instead.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga9064db5f49a1fd7cd3dbf02309c8c254}{
\index{usb\_\-api@{usb\_\-api}!USBIntDisableControl@{USBIntDisableControl}}
\index{USBIntDisableControl@{USBIntDisableControl}!usb_api@{usb\_\-api}}
\subsubsection[{USBIntDisableControl}]{\setlength{\rightskip}{0pt plus 5cm}void USBIntDisableControl (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga9064db5f49a1fd7cd3dbf02309c8c254}
Disable control interrupts on a given USB controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulFlags}]specifies which control interrupts to disable.\end{DoxyParams}
This function will disable the control interrupts for the USB controller specified by the {\itshape ulBase\/} parameter. The {\itshape ulFlags\/} parameter specifies which control interrupts to disable. The flags passed in the {\itshape ulFlags\/} parameters should be the definitions that start with {\bfseries USB\_\-INTCTRL\_\-$\ast$} and not any other {\bfseries USB\_\-INT} flags.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga413bae5d18d8c6fd4be4bdabdb0172e9}{
\index{usb\_\-api@{usb\_\-api}!USBIntDisableEndpoint@{USBIntDisableEndpoint}}
\index{USBIntDisableEndpoint@{USBIntDisableEndpoint}!usb_api@{usb\_\-api}}
\subsubsection[{USBIntDisableEndpoint}]{\setlength{\rightskip}{0pt plus 5cm}void USBIntDisableEndpoint (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga413bae5d18d8c6fd4be4bdabdb0172e9}
Disable endpoint interrupts on a given USB controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulFlags}]specifies which endpoint interrupts to disable.\end{DoxyParams}
This function will disable endpoint interrupts for the USB controller specified by the {\itshape ulBase\/} parameter. The {\itshape ulFlags\/} parameter specifies which endpoint interrupts to disable. The flags passed in the {\itshape ulFlags\/} parameters should be the definitions that start with {\bfseries USB\_\-INTEP\_\-$\ast$} and not any other {\bfseries USB\_\-INT} flags.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga53b0ca815f41c12d45a735e3e6d377de}{
\index{usb\_\-api@{usb\_\-api}!USBIntEnable@{USBIntEnable}}
\index{USBIntEnable@{USBIntEnable}!usb_api@{usb\_\-api}}
\subsubsection[{USBIntEnable}]{\setlength{\rightskip}{0pt plus 5cm}void USBIntEnable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga53b0ca815f41c12d45a735e3e6d377de}
Enables the sources for USB interrupts.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulFlags}]specifies which interrupts to enable.\end{DoxyParams}
This function will enable the USB controller's ability to generate the interrupts indicated by the {\itshape ulFlags\/} parameter. There are three groups of interrupt sources, IN Endpoints, OUT Endpoints, and general status changes, specified by {\bfseries USB\_\-INT\_\-HOST\_\-IN}, {\bfseries USB\_\-INT\_\-HOST\_\-OUT}, {\bfseries USB\_\-INT\_\-DEV\_\-IN}, {\bfseries USB\_\-INT\_\-DEV\_\-OUT}, and {\bfseries USB\_\-STATUS}. If {\bfseries USB\_\-INT\_\-ALL} is specified then all interrupts will be enabled.

\begin{DoxyNote}{Note}
A call must be made to enable the interrupt in the main interrupt controller to receive interrupts. The \hyperlink{group__usb__api_ga56f1a4f5b773b4b5a89b492b96ce57a0}{USBIntRegister()} API performs this controller level interrupt enable. However if static interrupt handlers are used then then a call to \hyperlink{group__interrupt__api_gaa17d17172b0304d0dc0596d7a0c86173}{IntEnable()} must be made in order to allow any USB interrupts to occur.

WARNING: This API cannot be used on endpoint numbers greater than endpoint 3 so \hyperlink{group__usb__api_gad152c2b8f218aed6f21dbf7ba54bea58}{USBIntEnableControl()} or \hyperlink{group__usb__api_gacc31ab0964a8382e894c8be830a6791e}{USBIntEnableEndpoint()} should be used instead.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gad152c2b8f218aed6f21dbf7ba54bea58}{
\index{usb\_\-api@{usb\_\-api}!USBIntEnableControl@{USBIntEnableControl}}
\index{USBIntEnableControl@{USBIntEnableControl}!usb_api@{usb\_\-api}}
\subsubsection[{USBIntEnableControl}]{\setlength{\rightskip}{0pt plus 5cm}void USBIntEnableControl (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gad152c2b8f218aed6f21dbf7ba54bea58}
Enable control interrupts on a given USB controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulFlags}]specifies which control interrupts to enable.\end{DoxyParams}
This function will enable the control interrupts for the USB controller specified by the {\itshape ulBase\/} parameter. The {\itshape ulFlags\/} parameter specifies which control interrupts to enable. The flags passed in the {\itshape ulFlags\/} parameters should be the definitions that start with {\bfseries USB\_\-INTCTRL\_\-$\ast$} and not any other {\bfseries USB\_\-INT} flags.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gacc31ab0964a8382e894c8be830a6791e}{
\index{usb\_\-api@{usb\_\-api}!USBIntEnableEndpoint@{USBIntEnableEndpoint}}
\index{USBIntEnableEndpoint@{USBIntEnableEndpoint}!usb_api@{usb\_\-api}}
\subsubsection[{USBIntEnableEndpoint}]{\setlength{\rightskip}{0pt plus 5cm}void USBIntEnableEndpoint (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulFlags}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gacc31ab0964a8382e894c8be830a6791e}
Enable endpoint interrupts on a given USB controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em ulFlags}]specifies which endpoint interrupts to enable.\end{DoxyParams}
This function will enable endpoint interrupts for the USB controller specified by the {\itshape ulBase\/} parameter. The {\itshape ulFlags\/} parameter specifies which endpoint interrupts to enable. The flags passed in the {\itshape ulFlags\/} parameters should be the definitions that start with {\bfseries USB\_\-INTEP\_\-$\ast$} and not any other {\bfseries USB\_\-INT} flags.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga56f1a4f5b773b4b5a89b492b96ce57a0}{
\index{usb\_\-api@{usb\_\-api}!USBIntRegister@{USBIntRegister}}
\index{USBIntRegister@{USBIntRegister}!usb_api@{usb\_\-api}}
\subsubsection[{USBIntRegister}]{\setlength{\rightskip}{0pt plus 5cm}void USBIntRegister (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{void($\ast$)(void)}]{ pfnHandler}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga56f1a4f5b773b4b5a89b492b96ce57a0}
Registers an interrupt handler for the USB controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em pfnHandler}]is a pointer to the function to be called when a USB interrupt occurs.\end{DoxyParams}
This sets the handler to be called when a USB interrupt occurs. This will also enable the global USB interrupt in the interrupt controller. The specific desired USB interrupts must be enabled via a separate call to \hyperlink{group__usb__api_ga53b0ca815f41c12d45a735e3e6d377de}{USBIntEnable()}. It is the interrupt handler's responsibility to clear the interrupt sources via a calls to \hyperlink{group__usb__api_gae13f9c6435c0f072af9643913fade315}{USBIntStatusControl()} and \hyperlink{group__usb__api_ga22cf47341e0dd3178ec17af248360dbd}{USBIntStatusEndpoint()}.

\begin{DoxySeeAlso}{See also}
\hyperlink{group__interrupt__api_ga471d00d73ae22faa426c202f608e9c69}{IntRegister()} for important information about registering interrupt handlers.
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga70f8544023e3df8fc650c8f18cd81e8f}{
\index{usb\_\-api@{usb\_\-api}!USBIntStatus@{USBIntStatus}}
\index{USBIntStatus@{USBIntStatus}!usb_api@{usb\_\-api}}
\subsubsection[{USBIntStatus}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long USBIntStatus (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga70f8544023e3df8fc650c8f18cd81e8f}
Returns the status of the USB interrupts.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function will read the source of the interrupt for the USB controller. There are three groups of interrupt sources, IN Endpoints, OUT Endpoints, and general status changes. This call will return the current status for all of these interrupts. The bit values returned should be compared against the {\bfseries USB\_\-HOST\_\-IN}, {\bfseries USB\_\-HOST\_\-OUT}, {\bfseries USB\_\-HOST\_\-EP0}, {\bfseries USB\_\-DEV\_\-IN}, {\bfseries USB\_\-DEV\_\-OUT}, and {\bfseries USB\_\-DEV\_\-EP0} values.

\begin{DoxyNote}{Note}
This call will clear the source of all of the general status interrupts.

WARNING: This API cannot be used on endpoint numbers greater than endpoint 3 so \hyperlink{group__usb__api_gae13f9c6435c0f072af9643913fade315}{USBIntStatusControl()} or \hyperlink{group__usb__api_ga22cf47341e0dd3178ec17af248360dbd}{USBIntStatusEndpoint()} should be used instead.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Returns the status of the sources for the USB controller's interrupt. 
\end{DoxyReturn}
\hypertarget{group__usb__api_gae13f9c6435c0f072af9643913fade315}{
\index{usb\_\-api@{usb\_\-api}!USBIntStatusControl@{USBIntStatusControl}}
\index{USBIntStatusControl@{USBIntStatusControl}!usb_api@{usb\_\-api}}
\subsubsection[{USBIntStatusControl}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long USBIntStatusControl (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_gae13f9c6435c0f072af9643913fade315}
Returns the control interrupt status on a given USB controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function will read control interrupt status for a USB controller. This call will return the current status for control interrupts only, the endpoint interrupt status is retrieved by calling \hyperlink{group__usb__api_ga22cf47341e0dd3178ec17af248360dbd}{USBIntStatusEndpoint()}. The bit values returned should be compared against the {\bfseries USB\_\-INTCTRL\_\-$\ast$} values.

The following are the meanings of all {\bfseries USB\_\-INCTRL\_\-} flags and the modes for which they are valid. These values apply to any calls to \hyperlink{group__usb__api_gae13f9c6435c0f072af9643913fade315}{USBIntStatusControl()}, \hyperlink{group__usb__api_gad152c2b8f218aed6f21dbf7ba54bea58}{USBIntEnableControl()}, and USBIntDisableConrol(). Some of these flags are only valid in the following modes as indicated in the parenthesis: Host, Device, and OTG.


\begin{DoxyItemize}
\item {\bfseries USB\_\-INTCTRL\_\-ALL} -\/ A full mask of all control interrupt sources.
\item {\bfseries USB\_\-INTCTRL\_\-VBUS\_\-ERR} -\/ A VBUS error has occurred (Host Only).
\item {\bfseries USB\_\-INTCTRL\_\-SESSION} -\/ Session Start Detected on A-\/side of cable (OTG Only).
\item {\bfseries USB\_\-INTCTRL\_\-SESSION\_\-END} -\/ Session End Detected (Device Only)
\item {\bfseries USB\_\-INTCTRL\_\-DISCONNECT} -\/ Device Disconnect Detected (Host Only)
\item {\bfseries USB\_\-INTCTRL\_\-CONNECT} -\/ Device Connect Detected (Host Only)
\item {\bfseries USB\_\-INTCTRL\_\-SOF} -\/ Start of Frame Detected.
\item {\bfseries USB\_\-INTCTRL\_\-BABBLE} -\/ USB controller detected a device signalling past the end of a frame. (Host Only)
\item {\bfseries USB\_\-INTCTRL\_\-RESET} -\/ Reset signalling detected by device. (Device Only)
\item {\bfseries USB\_\-INTCTRL\_\-RESUME} -\/ Resume signalling detected.
\item {\bfseries USB\_\-INTCTRL\_\-SUSPEND} -\/ Suspend signalling detected by device (Device Only)
\item {\bfseries USB\_\-INTCTRL\_\-MODE\_\-DETECT} -\/ OTG cable mode detection has completed (OTG Only)
\item {\bfseries USB\_\-INTCTRL\_\-POWER\_\-FAULT} -\/ Power Fault detected. (Host Only)
\end{DoxyItemize}

\begin{DoxyNote}{Note}
This call will clear the source of all of the control status interrupts.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Returns the status of the control interrupts for a USB controller. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga22cf47341e0dd3178ec17af248360dbd}{
\index{usb\_\-api@{usb\_\-api}!USBIntStatusEndpoint@{USBIntStatusEndpoint}}
\index{USBIntStatusEndpoint@{USBIntStatusEndpoint}!usb_api@{usb\_\-api}}
\subsubsection[{USBIntStatusEndpoint}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long USBIntStatusEndpoint (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga22cf47341e0dd3178ec17af248360dbd}
Returns the endpoint interrupt status on a given USB controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function will read endpoint interrupt status for a USB controller. This call will return the current status for endpoint interrupts only, the control interrupt status is retrieved by calling \hyperlink{group__usb__api_gae13f9c6435c0f072af9643913fade315}{USBIntStatusControl()}. The bit values returned should be compared against the {\bfseries USB\_\-INTEP\_\-$\ast$} values. These are grouped into classes for {\bfseries USB\_\-INTEP\_\-HOST\_\-$\ast$} and {\bfseries USB\_\-INTEP\_\-DEV\_\-$\ast$} values to handle both host and device modes with all endpoints.

\begin{DoxyNote}{Note}
This call will clear the source of all of the endpoint interrupts.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Returns the status of the endpoint interrupts for a USB controller. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga166af544e888c91b7e284ee0c43b2113}{
\index{usb\_\-api@{usb\_\-api}!USBIntUnregister@{USBIntUnregister}}
\index{USBIntUnregister@{USBIntUnregister}!usb_api@{usb\_\-api}}
\subsubsection[{USBIntUnregister}]{\setlength{\rightskip}{0pt plus 5cm}void USBIntUnregister (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga166af544e888c91b7e284ee0c43b2113}
Unregisters an interrupt handler for the USB controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function unregister the interrupt handler. This function will also disable the USB interrupt in the interrupt controller.

\begin{DoxySeeAlso}{See also}
\hyperlink{group__interrupt__api_ga471d00d73ae22faa426c202f608e9c69}{IntRegister()} for important information about registering or unregistering interrupt handlers.
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga2cf0f15617aa69bc0fdf6f3df9f0b572}{
\index{usb\_\-api@{usb\_\-api}!USBModeGet@{USBModeGet}}
\index{USBModeGet@{USBModeGet}!usb_api@{usb\_\-api}}
\subsubsection[{USBModeGet}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long USBModeGet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga2cf0f15617aa69bc0fdf6f3df9f0b572}
Returns the current operating mode of the controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address.\end{DoxyParams}
This function returns the current operating mode on USB controllers with OTG or Dual mode functionality.

For OTG controllers:

The function will return on of the following values on OTG controllers: {\bfseries USB\_\-OTG\_\-MODE\_\-ASIDE\_\-HOST}, {\bfseries USB\_\-OTG\_\-MODE\_\-ASIDE\_\-DEV}, {\bfseries USB\_\-OTG\_\-MODE\_\-BSIDE\_\-HOST}, {\bfseries USB\_\-OTG\_\-MODE\_\-BSIDE\_\-DEV}, {\bfseries USB\_\-OTG\_\-MODE\_\-NONE}.

{\bfseries USB\_\-OTG\_\-MODE\_\-ASIDE\_\-HOST} indicates that the controller is in host mode on the A-\/side of the cable.

{\bfseries USB\_\-OTG\_\-MODE\_\-ASIDE\_\-DEV} indicates that the controller is in device mode on the A-\/side of the cable.

{\bfseries USB\_\-OTG\_\-MODE\_\-BSIDE\_\-HOST} indicates that the controller is in host mode on the B-\/side of the cable.

{\bfseries USB\_\-OTG\_\-MODE\_\-BSIDE\_\-DEV} indicates that the controller is in device mode on the B-\/side of the cable. If and OTG session request is started with no cable in place this is the default mode for the controller.

{\bfseries USB\_\-OTG\_\-MODE\_\-NONE} indicates that the controller is not attempting to determine its role in the system.

For Dual Mode controllers:

The function will return on of the following values: {\bfseries USB\_\-DUAL\_\-MODE\_\-HOST}, {\bfseries USB\_\-DUAL\_\-MODE\_\-DEVICE}, or {\bfseries USB\_\-DUAL\_\-MODE\_\-NONE}.

{\bfseries USB\_\-DUAL\_\-MODE\_\-HOST} indicates that the controller is acting as a host.

{\bfseries USB\_\-DUAL\_\-MODE\_\-DEVICE} indicates that the controller acting as a device.

{\bfseries USB\_\-DUAL\_\-MODE\_\-NONE} indicates that the controller is not active as either a host or device.

\begin{DoxyReturn}{Returns}
Returns {\bfseries USB\_\-OTG\_\-MODE\_\-ASIDE\_\-HOST}, {\bfseries USB\_\-OTG\_\-MODE\_\-ASIDE\_\-DEV}, {\bfseries USB\_\-OTG\_\-MODE\_\-BSIDE\_\-HOST}, {\bfseries USB\_\-OTG\_\-MODE\_\-BSIDE\_\-DEV}, {\bfseries USB\_\-OTG\_\-MODE\_\-NONE}, {\bfseries USB\_\-DUAL\_\-MODE\_\-HOST}, {\bfseries USB\_\-DUAL\_\-MODE\_\-DEVICE}, or {\bfseries USB\_\-DUAL\_\-MODE\_\-NONE}. 
\end{DoxyReturn}
\hypertarget{group__usb__api_ga048c5620ed2d97e02b1f96c10dcd8e9f}{
\index{usb\_\-api@{usb\_\-api}!USBOTGSessionRequest@{USBOTGSessionRequest}}
\index{USBOTGSessionRequest@{USBOTGSessionRequest}!usb_api@{usb\_\-api}}
\subsubsection[{USBOTGSessionRequest}]{\setlength{\rightskip}{0pt plus 5cm}void USBOTGSessionRequest (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{tBoolean}]{ bStart}
\end{DoxyParamCaption}
)}}
\label{group__usb__api_ga048c5620ed2d97e02b1f96c10dcd8e9f}
Starts or ends a session.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]specifies the USB module base address. \item[{\em bStart}]specifies if this call starts or ends a session.\end{DoxyParams}
This function is used in OTG mode to start a session request or end a session. If the {\itshape bStart\/} parameter is set to {\bfseries true}, then this function start a session and if it is {\bfseries false} it will end a session.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
